<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>demo</title>
    <script src="../common/vue.min.js" type="text/javascript"></script>
    <style type="text/css">

    </style>
</head>
<body>
<!--view-->
<div id="e2">
    <h1 v-if="b=='1'">Yes</h1>
    <h1 v-else>NO</h1>

    <template v-if="a">
        <b>
            一段文字加粗...
        </b>
    </template>

    <hr/>
    <div v-show="a">v-show会始终保持在dom元素中，而v-if是控制display:none</div>

</div>


<script type="text/javascript">


    /**
     *
     */
    var vm = new Vue({
        el: '#e2', //el :element
        data: {
            a: true,
            raw_html: "<span style='color: red'><b>你好啊</b></span>",
            b: "1",
            c: 1,
            d: 2,
            e: "reese",
            url: "http://www.baidu.com",
            cssData1: {
                'class-a': true,
                'class-b': false
            },
            cssData2: {
                isA: false,
                isB: true
            }
        },
        //TODO 钩子是什么
        //vm实例创建后的钩子
        created: function () {
            console.log(this);//vm实例
            console.log("a1:" + this.a);
            console.log("a2:" + this.$data.a);
            console.log(this.a == this.$data.a);
        }
    })
    //    vm.$data.a = false;

    //TODO 点击后不执行
    function doSomething() {
        alert(1);
        alert(vm.$data.url);
    }


</script>

</body>
</html>